package com.jinzhi.jzweb.controller;


import java.util.*;

import com.jinzhi.jzweb.domain.param.SignUserQuery;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import com.baomidou.mybatisplus.plugins.Page;
import com.jinzhi.common.base.BaseController;
import com.jinzhi.jzweb.domain.JazSignupUserDO;
import com.jinzhi.jzweb.service.JazSignupUserService;
import com.jinzhi.common.utils.Result;

import javax.servlet.http.HttpServletResponse;

/**
 * 
 * <pre>
 * 报名用户（选手）表
 * </pre>
 * <small> 2024-09-05 15:21:59 | Long</small>
 */
@Controller
@RequestMapping("/jzweb/jazSignupUser")
public class JazSignupUserController extends BaseController {
	@Autowired
	private JazSignupUserService jazSignupUserService;

	/**
	 * 分页查询
	 * @param signUserQuery
	 * @return
	 */
	@ResponseBody
	@GetMapping("/list")
	public Result<Page<JazSignupUserDO>> list(SignUserQuery signUserQuery){
        return Result.ok(jazSignupUserService.selectListPage(signUserQuery));
	}

	/**
	 * 根据id查询
	 * @param id
	 * @return
	 */
	@ResponseBody
	@GetMapping("/getById")
	public JazSignupUserDO getById(Long id){
		return jazSignupUserService.getById(id);
	}


	/**
	 * 修改审核状态
	 * @param jazSignupUser
	 * @return
	 */
	@ResponseBody
	@PostMapping("/update")
	public Result<String>  update(@RequestBody JazSignupUserDO jazSignupUser){
		return jazSignupUserService.updateStatusById(jazSignupUser);
	}


	/**
	 * 修改选手信息
	 * @param jazSignupUser
	 * @return
	 */
	@ResponseBody
	@PostMapping("/updateSignupUser")
	public Result<String>  updateSignupUser(@RequestBody JazSignupUserDO jazSignupUser){
		return jazSignupUserService.updateSignupUserById(jazSignupUser);
	}


	
	//@Log("删除报名用户（选手）表")
	@PostMapping( "/remove")
	@ResponseBody
	public Result<String>  remove( Long id){
		jazSignupUserService.deleteById(id);
        return Result.ok();
	}
	
	//@Log("批量删除报名用户（选手）表")
	@PostMapping( "/batchRemove")
	@ResponseBody
	@RequiresPermissions("jzweb:jazSignupUser:batchRemove")
	public Result<String>  remove(@RequestParam("ids[]") Long[] ids){
		jazSignupUserService.deleteBatchIds(Arrays.asList(ids));
		return Result.ok();
	}


	/**
	 * 导出报名信息
	 * @param response
	 * @param signUserQuery
	 */
	//@Log(value = "导出系统日志",sysModule = 12,operationType = 4)
	@ResponseBody
	@GetMapping("/download")
	public void downloadImportTemplate(HttpServletResponse response, SignUserQuery signUserQuery) {
		jazSignupUserService.downloadImportTemplate(response, signUserQuery);
	}

}
